package file

import (
	"gitee.com/mootok/mootok/src/constant/config"
	"github.com/qiniu/go-sdk/v7/auth/qbox"
	"io"
)

var Instance StorageProvider

func init() {
	if config.EnvConfig.StorageProvider == "kodo" {
		Instance = &KodoStorage{
			mac: qbox.NewMac(config.EnvConfig.QiNiuAccessKey, config.EnvConfig.QiNiuSecretKey),
		}
	}
}

type StorageProvider interface {
	UploadToken(fileName string, mimeType string, deadline int64, options *map[string]string) string
	BatchDelete(fileNames []string) ([]bool, error)
	GetLink(fileName string, deadline int64, query *string) string
	UploadFile(destFileName string, input io.Reader, uploadToken string) error
	IsExists(fileName string) (bool, error)
}
